<template>
  <div class="tab-container">
    <div
      v-for="item in tabList"
      :key="item.id"
      class="tab-item"
      :class="{ 'active-color': activeIndex === item.id }"
      @click="tabClick(item.id)"
    >
      <span>{{ item.text }}</span>
    </div>
  </div>
</template>

<script setup lang="ts">
const tabList = reactive([
  {
    id: 0,
    text: '单 位',
  },
  {
    id: 1,
    text: '附 件',
  },
])

const emit = defineEmits(['tabClick'])
const activeIndex = ref(0)

const tabClick = (id: number) => {
  activeIndex.value = id
  emit('tabClick', id)
}
</script>

<style lang="less" scoped>
.tab-container {
  width: 40px;
  margin-top: 3px;
  .tab-item {
    position: relative;
    top: 10px;
    transform: skewy(-30deg);
    height: 160px;
    margin-bottom: 15px;
    border-right: 2px solid #11b3a1;
    background: rgba(1, 10, 15, 0.7);
    cursor: pointer;
    span {
      transform: skewy(30deg);
      width: 100%;
      height: 100%;
      writing-mode: vertical-rl;
      line-height: 39px;
      font-size: 20px;
      text-align: center;
      color: white;
    }
  }
  .active-color {
    background-color: rgba(26, 137, 145, 0.8);
    span {
      font-weight: 700;
    }
  }
}
</style>
